/**
 * Copyright &copy; com.nmf
 */
package com.nmf.pc.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nmf.pc.vo.McSmsReq;
import com.nmf.pc.vo.ReturnResult;
import com.nmf.pc.vo.SmsCodeReq;
import com.nmf.site.biz.member.gen.service.BizMemberService;
import com.nmf.site.biz.sms.bx.service.SmsCodeService;
import com.nmf.site.common.web.BaseController;
import com.taobao.api.ApiException;

/**
 * 订单Controller
 * @author 北冥
 * @version 2018-02-10
 */
@Controller
@RequestMapping(value = "/pc")
public class PcSmsnController extends BaseController {
	@Autowired
	BizMemberService bizMemberService;
	@Autowired
	SmsCodeService smsCodeService;
	
	
	@RequestMapping(value = {"p/mem/sendMobileCode"},method = {RequestMethod.POST,RequestMethod.GET})
	@ResponseBody
	public ReturnResult sendMobileCode(@Valid SmsCodeReq smsCodeReq, BindingResult result,HttpServletRequest request, HttpServletResponse response) throws ApiException {
		ReturnResult returnResult = new ReturnResult();
		String code = smsCodeService.sendMobileCode(smsCodeReq);
		returnResult.setData("code",code);
		return returnResult;
	}
	
	
	@RequestMapping(value = {"c/mem/sendSms"},method = {RequestMethod.POST,RequestMethod.GET})
	@ResponseBody
	public ReturnResult sendSms(@Valid McSmsReq mcSmsReq, BindingResult result,HttpServletRequest request, HttpServletResponse response) throws ApiException {
		ReturnResult returnResult = smsCodeService.sendMobileSms(mcSmsReq);
		return returnResult;
	}
}